<extend name="./Application/Admin/View/Public/base.html" />
<block name="eosi-css">
    <link href="__PUBLIC__/assets/css/daterangepicker.css" rel="stylesheet">
    <link href="__PUBLIC__/assets/css/rili.css" rel="stylesheet">
</block>

<block name="eosi-js"> 
    <script src="__PUBLIC__/assets/js/date-time/bootstrap-datepicker.min.js"></script>
    <script src="__PUBLIC__/assets/js/jqGrid/jquery.jqGrid.min.js"></script>
    <script src="__PUBLIC__/assets/js/jqGrid/i18n/grid.locale-en.js"></script>
    <script src="__PUBLIC__/assets/js/jqGrid/laydate.dev.js"></script>
    <script type="text/javascript">
                var $path_base = "/"; 
    </script>

</block>
<block name="page-content">
    <div  class=""  style="height: 40px;">
        <span class="input-icon"> 
            <input type="text" placeholder="查询用户"   value="{$nicknamex}"
            class="nav-search-input" id="nickname" autocomplete="off" /> 
        </span>
        <span class="input-icon"> 
            <input type="text" id="J-xl"  placeholder="选择日期"  value="{$str}">
        </span>  
        <span class="input-icon"> 
            <input type="text" placeholder="查询附注"   value="{$memo}"
            class="nav-search-input" id="memo" autocomplete="off" /> 
        </span>
        <input type="button" id="search" value="查询"/>
        <input type="button" id="resetBt" value="重置筛选条件" />
         
    </div>
    <div class="row">
        <div class="col-xs-12">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>                    
                        <th>用户</th>
                        <th>日期</th>
                        <th>选择的造型</th>
                        <th>附注</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>状态</th>
                        <th>是否显示在月日历</th>       
                    </tr>
                </thead>
                <tbody>
                    <volist name="_list" id="vo">
                        <tr>
                            <td>{$vo.nickname}</td>
                            <td>{$vo.riqi}</td> 
                            <td>
                                <a target="_blank" href="{$vo.img}" title="点击查看大图">
                               <img src="{$vo.s_img}" style='height: 120px'>
                                </a>
                            </td>
                            <td>{$vo.memo}</td>
                            <td>{$vo.create_time}</td>
                            <td>{$vo.update_time}</td>
                            <td id="status{$vo.id}">{$vo.status_str}</td>
                            <td>{$vo.is_top}</td>
                            
                        </tr>
                    </volist>
                </tbody>
            </table>
            <div class="pager">{$_page}</div>
        </div>
    </div><!-- /.row -->

    <script type="text/javascript">
           laydate({
                elem: '#J-xl'
            });
         $("#search").click(function(){
            var nicknamex=$('#nickname').val();
            var bname=$("#J-xl").val();
            var memo=$('#memo').val();
            if(nicknamex !=''){
                nicknamex="/nicknamex/"+nicknamex;
            }
            if(memo !=''){
                memo="/memo/"+memo;
            }
            // 日期参数
            if(bname !=''){
                bname="/bname/"+bname;
            }
            location.href = "/Admin/Calendar/index"+nicknamex+memo+bname;
        });
         $("#resetBt").click(function(){
            location.href = "/Admin/Calendar/index";
        });
        // 状态切换  ajax
        $(document).ready(function(){
                $('body').on('click', '.hand', function(){
                    var ad ={};
                    ad['id'] = $(this).attr('index');
                    ad['type'] =$(this).prev().text();
                    var id = $(this).attr('index');
                    var type = $(this).prev().text();
                    $.ajax({
                        cache:false,
                        type: "POST",
                        url: "__APP__/Admin/Calendar/status_change",
                        data:ad,
                        error:function(){
                            alert("网络原因修改失败,请稍候再试");
                        },
                        success:function(data){                        
                            if(data.status==1){    
                                var html = '';
                                if (type == '有效') {
                                    html += "<span class=\"label label-sm label-info arrowed-in\">无效</span>&nbsp;|&nbsp;&nbsp;&nbsp;<span class=\"hand icon-unlock green bigger-125\" title=\"启用\"  index='" + id + "' ></span>";
                                } else {
                                    html += "<span class=\"label label-sm label-success arrowed-in\">有效</span>&nbsp;|&nbsp;&nbsp;&nbsp;<span class=\"hand icon-lock red bigger-125\" title=\"禁用\"  index='" + id + "' ></span>";
                                }
                                $('#status' + id).html(html);
                            }else{
                                alert(data.info);
                        }
                    }
                    });
            });
        })        
    </script>
</block>